//
//  receiveChatArrive.m
//  tcpoctest
//
//  Created by apple on 13-7-19.
//  Copyright (c) 2013年 gump. All rights reserved.
//

#import "receiveChatArrive.h"
#import "sendMessageReceipt.h"
#import "chatDataSource.h"
#import "ChatContentInfo.h"
#import "chatuserdb.h"

@implementation receiveChatArrive

-(void)processreceive
{
    //接收 16char(1),230char(1), 已阅消息ID长度char(1),
    //已阅消息IDchar(x),本消息ID长度char(1),本消息IDchar(x),
    
    NSString *chatid = [logicsb ReadUnencodeString];
    
    ChatContentInfo *ccinfo = [[DataControl shareControl].chatDS getChatInfoByID:chatid];
    if (ccinfo != nil &&
        ccinfo.ichatReadState != CRS_READ) {
        ccinfo.ichatReadState = CRS_ARRIVE;
        
        [[DataBaseCtrol shareControl].chatuserdatabase UpdateChatState:ccinfo];
        [[DataControl shareControl].UICommendDS addUICommand:UC_CHAT_REFRESH];
    }
    
    NSString *msgid = [logicsb ReadUnencodeString];
    
    [[netManager sharedNetManager].sendMsgReceipt SendMegReceipt:msgid];
    
    
    [self ShowLog];
}

@end
